﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace HCQ2_Model.Pay
{
    /// <summary>
    /// 后台调用“微信支付统一下单”参数
    /// </summary>
    public class WeChatUnifiedOrderParams:IParentOrderID
    {
        /// <summary>
        /// 【必填】系统内部订单号
        /// </summary>
        [Required(ErrorMessage = "系统内部订单号不能为空")]
        public string ParentOrderCode { get; set; }

        /// <summary>
        /// 【必填】订单支付金额
        /// </summary>
        [Required(ErrorMessage ="订单支付金额不能为空")]
        public decimal? CommodityMoney { get; set; }

        /// <summary>
        /// 小程序用户OpenId
        /// </summary>
        public string OpenId { get; set; }

        /// <summary>
        /// 商品信息描述，最大长度128
        /// </summary>
        [MaxLength(128)]
        public string Body { get; set; } = "VR设备观看时长购买";

        /// <summary>
        ///  业务Key
        /// </summary>
        public string key { get; set; }

        /// <summary>
        /// 商品的标题/交易标题/订单标题/订单关键字等。
        /// </summary>
        public string Subject { get; set; }
       
        /// <summary>
        /// 创建一个对象
        /// </summary>
        /// <param name="parentOrderCode">系统内部订单号</param>
        /// <param name="commodityMoney">支付金额</param>
        /// <param name="openId">微信openid</param>
        public WeChatUnifiedOrderParams(string parentOrderCode, decimal? commodityMoney, string openId)
        {
            ParentOrderCode = parentOrderCode;
            CommodityMoney = commodityMoney;
            OpenId = openId;
        }
    }
}
